//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Media;

namespace OpenLS.Core.Formatting
{
    class ColorToken : ClauseFormatToken
    {
        public ColorToken(Color c)
        {
            Value = c;
        }
        public readonly Color Value;

        internal override void Apply(FormatClause result)
        {
            result.color = Value;
        }

        internal override string Code
        {
            get
            {
                if (Value == Colors.Red) return "red";
                if (Value == Colors.Black) return "black";
                if (Value == Colors.Blue) return "blue";
                if (Value == Colors.Cyan) return "cyan";
                if (Value == Colors.Green) return "green";
                if (Value == Colors.Magenta) return "magenta";
                if (Value == Colors.White) return "white";
                if (Value == Colors.Yellow) return "yellow";
                throw new NotSupportedException();
            }
        }
    }
}